package com.sumainfor.wx.system.maket.controller;

import com.qiniu.util.Json;
import com.sumainfor.common.util.ContextUtils;
import com.sumainfor.common.util.JsonResult;
import com.sumainfor.wx.system.feign.BaseFeignTenant;
import com.sumainfor.wx.system.maket.service.LeaseConsultantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * <p>
 *租赁顾问本月排名
 * <p>
 *
 * @author: zc
 * @create: 2019-08-15 14:32
 **/

@Controller
@RequestMapping("/LeaseConsultant")
public class LeaseConsultantController {

    @Autowired
    LeaseConsultantService leaseConsultantService;

    @Autowired
    BaseFeignTenant baseFeignTenant;



    /**
     * 本月公司排名
     * @author zhoucong
     * @data 2019/8/15
     * @Param
     * @return
     */
    @ResponseBody
    @GetMapping("/getMarketSalesClinchCom")
    public JsonResult getMarketSalesClinchCom(@RequestParam Map<String,Object> params){
        JsonResult result = new JsonResult();
        return result.put(leaseConsultantService.getMarketSalesClinchCom(params));
    }


    /**
     * 租赁顾问的本月成交排名
     * @author zhoucong
     * @data 2019/8/15
     * @Param
     * @return
     */
    @ResponseBody
    @GetMapping("/getMarketSalesHeart")
    public JsonResult getMarketSalesHeart(@RequestParam Map<String,Object> params){
        JsonResult result = new JsonResult();
        return result.put(leaseConsultantService.getMarketSalesHeart(params));
    }



    /**
     * 今日已签约，未来需带看，在跟租客
     * @author zhoucong
     * @data 2019/8/15
     * @Param
     * @return
     */
    @ResponseBody
    @GetMapping("/getMarketSalesStatus")
    public JsonResult getMarketSalesStatus(@RequestParam Map<String,Object> params){
        params.put("UserId", ContextUtils.getUserId());
        return leaseConsultantService.getMarketSalesStatus(params);

    }


    /**
     * 今日已带看，本月已带看，本月已签约 签约成交率
     * @author zhoucong
     * @data 2019/8/15
     * @Param
     * @return
     */
    @ResponseBody
    @GetMapping("/getStatus")
    public JsonResult getStatus(@RequestParam Map<String,Object> params){
        params.put("UserId", ContextUtils.getUserId());
        return leaseConsultantService.getStatus(params);
    }



    /**
     * 根据手机号查询客户信息
     * @author zhoucong
     * @data 2019/8/23
     * @Param
     * @return
     */
    @ResponseBody
    @GetMapping("/getTenantByTenPhone")
    public JsonResult getTenantByTenPhone(@RequestParam Map<String,Object> params){
        return baseFeignTenant.getTenantByTenPhone(params);
    }
}
